export { History, Location } from "history";

// 基础props
export interface IProps {
  children?: React.ReactNode;
  location: ILocation;
  history: IHistory;
  [propName: string]: any;
}
//location
export interface ILocation {
  state?: ILocationState;
  [propName: string]: any;
}

// location 的 state
interface ILocationState {
  id: number;
  label?: string;
}

// history
interface IHistory {
  action: string;
  [propName: string]: any;
}

// IDispatch
export interface IDispatch {
  [model: string]: { [action: string]: (arg: any) => void };
}

// 基础列表
export interface IStateList {
  totalSize: number;
  pageSize: number;
  pageNum: number;
  searchData?: any;
  [propName: string]: any;
}

// 基础详情
export interface IStateItem<T = any> {
  [item: string]: T;
}

// 自定义select
export interface ISelectOption {
  name: string;
  id?: number;
  [extraProps: string]: any;
}

// ajax请求
export interface IAjaxState<T = any> {
  status: number;
  msg: string;
  result: IStateList | IStateItem | T;
}

// ajax请求
export interface IAjax<T = any> {
  code: number;
  result?: T;
}

// 省接口
export interface IProvince {
  code: string;
  name: string;
  subList?: ICity[];
}
// 市接口
export interface ICity {
  code: string;
  name: string;
}

// 定义路由接口
export interface RouteType {
  label?: string;
  path?: string;
  exact?: boolean;
  component: Function;
}

// 定义IForm （action传参interface）
export interface IForm {
  [name: string]: any;
}
// 定义list Pageinfo 商机
export interface IPageInfo {
  pageSize: number;
  pageNum: number;
}

// 定义list Pageinfo 产品
export interface IPageInfoP {
  pageSize: number;
  currPage: number;
}

//定义IFormItem 接口
export interface IFormItem {
  key: number;
  label: string | JSX.Element;
  name: string;
  initialValue?: string | number;
  component?: JSX.Element;
  rules?: any[];
}
